# Create your views here.
from cdsay.up1.form import ThingForm
from django.shortcuts import render_to_response
from cdsay.up1.models import Thing

def thing_add(request): 
    if request.method == 'POST': 
        if 'file' in request.FILES: 
            upFile = request.FILES['file']
            
            #request.FILES['file']['filename'] = ''.join(['test/', request.FILES['file']['filename']]) 
            form = ThingForm(upFile) 
            if form.is_valid(): 
                form.save()
    else: 
        form = ThingForm() 
    form = ThingForm() 
    return render_to_response('upfile.html', {'form': form})
